package common.model.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import common.model.enums.ClassificationTypeEnum;
import common.model.po.base.BasePo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 分类
 *
 * @author 米泽鹏
 * @since 2022-02-26
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ToString(callSuper = true)
@TableName("g_classification")
public class GClassification extends BasePo<GClassification> {

	private static final long serialVersionUID = 1L;

	/**
	 * 父级类别id，0表示顶级类别
	 */
	private Long parentId;

	/**
	 * 类型
	 */
	private ClassificationTypeEnum type;

	/**
	 * 同级类别中的排序
	 */
	private Integer sort;

	/**
	 * 类别名称
	 */
	private String name;

	/**
	 * el-tree组件每个节点的id，在一棵树中必然存在且是唯一的
	 */
	@TableField(exist = false)
	private Long treeNodeId;

	/**
	 * 父级节点的treeNodeId
	 */
	@TableField(exist = false)
	private Long parentTreeNodeId;

	@Override
	public Serializable pkVal() {
		return super.getId();
	}

}
